import { fetch } from '@/utils/c_request'
import { getToken } from '@/utils/auth'
export function loginByUsername(account, password) {
  const data = {
    'account': account,
    'password': password
  }
  return fetch({ method: 'post', url: '/user/login/signin', data })
}

// export function logout() {
//   return request({
//     url: '/login/logout',
//     method: 'post'
//   })
// }

export function getUserInfo(token) {
  return new Promise((resolve, reject) => {
    const data = {
      data: {
        roles: ['admin']
      }
    }
    if (token || getToken()) {
      console.log(getToken)
      data.data.roles = [token] || [getToken()]
    }
    console.log(data)
    resolve(data)
  })
  
  // return request({
  //   url: '/user/info',
  //   method: 'get',
  //   params: { token }
  // })
}

